import { Injectable } from '@angular/core';
import {HttpService} from './http.service';
import {API} from '../api';
import {PageInfo} from '../model/pageInfo';
import {EmployeeList} from '../model/employee-list';



@Injectable({
  providedIn: 'root',
})
export class EmployeeListService {

  constructor(private httpService: HttpService) {
  }
  // 下载导入模版
  async downloadImportTemplate( ) {
    window.open(API.DOWNLOAD_IMPORT_TEMPLATE, '_parent');
  }
  // 员工列表
  async employeelist(param: {s?: string, pageSize?: number, pageNum?: number}): Promise<PageInfo<EmployeeList>> {
    return await this.httpService.get(API.EMPLOYEE_LIST, param);
  }
  // 导出
  async export() {
    window.open(API.EXPORT, '_parent');
  }
  // 修改状态
  async modifyState(param: {name: string, state: string}) {
    return await this.httpService.get(API.MODIFY_STATE, param);
  }
  // 删除
  async delete(param: {name: string}) {
    return await this.httpService.get(API.DELETE, param);
  }
}
